#include <iostream>
#include <string>
#include <string.h>

using namespace std;

class a
{
public:
    int x;
    a()
    {
        x = 10;
        cout << "父类a不带参" << endl;
    }
    a(int n)
    {
        x = 10;
        cout << "父类a带参" << endl;
    }
    virtual void printName()
    {
        cout << "我是A类" << endl;
    }
    virtual ~a()
    {
        cout << "~a" << endl;
    }
};

class b : virtual public a
{
public:
    b()
    {
        x = 100;
        cout << "子类b" << endl;
    }
    void printName()
    {
        cout << "我是B类" << endl;
    }
    ~b()
    {
        cout << "~b" << endl;
    }
};

class c : virtual public a
{
public:
    c()
    {
        x = 1000;
        cout << "子类c" << endl;
    }
    void printName()
    {
        cout << "我是C类" << endl;
    }
    ~c()
    {
        cout << "~c" << endl;
    }
};

class d : public b, public c
{
public:
    d()
    {
        cout << "我是d类" << endl;
    }
    ~d()
    {
        cout << "~d" << endl;
    }
    void printName()
    {
        cout << "D" << endl;
    }
};

int main()
{

    a *p = new d;
    p->printName();
    delete p;
}